package universe;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class Discrete implements IUniverseOfDiscourse {
	
	private Set<Double> elements = new TreeSet<>();

	@Override
	public Set<Double> getElements() {
		return elements;
	}
	
	@Override
	public Boolean isExists(double element) {
		return elements.contains(element);
	}
	
	public void addElement(double element) {
		elements.add(element);
	}

	@Override
	public double getMinBoundary() {
		Iterator<Double> it = elements.iterator();
		
		if (it.hasNext()) {
			return it.next();
		}
		return 0;
	}

	@Override
	public double getMaxBoundary() {
		Iterator<Double> it = elements.iterator();
		double max = 0.0;
		
		while (it.hasNext()) {
			max = it.next();
		}
		
		return max;
	}

}
